package com.tdkj.service.shop.impl;

import java.math.BigDecimal;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.tdkj.dao.shop.IBeanGoodShowcaseCustomDao;
import com.tdkj.model.shop.BeanGoodShowcaseCustom;
import com.tdkj.service.BaseService;
import com.tdkj.service.shop.IBeanGoodShowcaseCustomService;
@Component
public class BeanGoodShowcaseCustomServiceImpl extends BaseService implements
		IBeanGoodShowcaseCustomService {

	private IBeanGoodShowcaseCustomDao beanGoodShowcaseCustomDao;
	
	/**
	 * @param beanGoodShowcaseCustomDao the beanGoodShowcaseCustomDao to set
	 */
	@Resource
	public void setBeanGoodShowcaseCustomDao(
			IBeanGoodShowcaseCustomDao beanGoodShowcaseCustomDao) {
		this.beanGoodShowcaseCustomDao = beanGoodShowcaseCustomDao;
	}

	@Override
	public BeanGoodShowcaseCustom add(Integer quantity, String unit,
			BigDecimal price) {
		BeanGoodShowcaseCustom bean = new BeanGoodShowcaseCustom();
		
		bean.setPrice(price);
		bean.setQuantity(quantity);
		bean.setUnit(unit);
		beanGoodShowcaseCustomDao.save(bean);
		
		return bean;
	}

	@Override
	public void update(Long id, Integer quantity, String unit, BigDecimal price) {
		BeanGoodShowcaseCustom bean = beanGoodShowcaseCustomDao.findById(id, BeanGoodShowcaseCustom.class);
		
		bean.setPrice(price);
		bean.setQuantity(quantity);
		bean.setUnit(unit);
	}

}
